<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <div id="app">
    <my-cpn> </my-cpn>
    <!-- 默认my-cpn中的内容会替换所有没有名字的插槽 -->
    <my-cpn> <span>我是替换</span></my-cpn>
    <my-cpn>
      <span slot="center">我是替换</span>
    </my-cpn>
  </div>
  <template id="myCpn">
      <div>
        <slot name="left">我在左边</slot>
        <slot name="center">我在中间</slot>
        <slot name="right">我在右边</slot>
        <slot>我没名字</slot>
      </div>
    </template>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: "#app",
      data: {
        message: "hello",
      },
      components: {
        myCpn: {
          template: "#myCpn",
        },
      },
    });
  </script>
</body>

</html>